<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <!-- v-model修饰符 --> 
        <!-- 去前后空格 -->
        <!-- <input v-model.trim="val" type="text"> -->
        <!-- 把内容转换为数字类型 -->
        <!-- <input v-model.number="val" type="text"> -->
        <input v-model.lazy="val" @input="input" type="text">
        <!--  -->
        <h2>
            {{ val }}
        </h2>
        <!-- <button @click="btn">按钮</button> -->
    </div>

    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
    <script>
        const app = new Vue({
            el: "#app",
            data: {
                val: ""
            },
            methods: {
                input() {
                    console.log(this.val)
                }
            }
        })


    </script>
</body>

</html>